<script type="text/javascript">
$(function () {
	var url = '${contextPath}script/inv/invSaleInfo.js';
	$.ajax({url:url, dataType:'script', cache:true,
		success: function(){
		}
	});
		$('#dname').autocomplete(${(type)!'[]'}, {
			max: 12,    //列表里的条目数
			minChars: 0,    //自动完成激活之前填入的最小字符
			width: 200,     //提示的宽度，溢出隐藏
			scrollHeight: 300,   //提示的高度，溢出显示滚动条
			matchContains: true,    //包含匹配，就是data参数里的数据，是否只要包含文本框里的数据就显示
			autoFill: false,    //自动填充
			formatItem: function(row, i, max) {
			 return i + '/' + max + ':"' + row.dname + '"';
			},
			formatMatch: function(row, i, max) {
			 return row.dname + row.dc;
			},
			formatResult: function(row) {
			  return row.dname;
			}
		}).result(function(event, row, formatted) {
			$('#dc').val(row.dc);
		});
	$('.add-tag-input').keydown(function(e){
		  if (e.keyCode==13){
			  loadCommodity_invSaleInfo($(this));
			  this.value = "";
		  }
	});
	$('#editForm').keydown(function(e){
		  if (e.keyCode==98){
			  loadCommodity_invSaleInfo($(this));
			  this.value = "";
		  }
	});
	$('#editForm').find("input:checkbox, input:radio").not('input.ibtn').uniform();
});
</script>

<style>
.my-filter-table {
	background: linear-gradient(to bottom, #F1FAFE 0%, #D9EDF7 100%) repeat scroll 0 0 rgba(0, 0, 0, 0);
	border: 1px solid #9BE2F0;
	display: inline-block;
	margin-bottom: 5px;
	margin-left: 5px;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}
.my-filter-table a {
	color: #3A87AD;
    display: inline-block;
    margin: 0 4px;
}

.my-filter-table button {
	background: none repeat scroll 0 0 rgba(0, 0, 0, 0);
    border: 0 none;
    cursor: pointer;
    padding: 0;
    color: #000000;
    float: right;
    font-size: 20px;
    font-weight: bold;
    line-height: 20px;
    opacity: 0.4;
    text-shadow: 0 1px 0 #FFFFFF;
}

.add-tag-input {
	width:80px;
}
</style>

<#import "/freemarker/modeltype.ftl" as mt>
<#import "/freemarker/modeltype_entity.ftl" as mte>
<div>
	<h3 class="title"><i class="fontello-icon-th-list-1"></i> 编辑零售信息</h3>
</div>
<h4>&nbsp;&nbsp;</h4>
<div class="widget" >
	<div class="widget-content">
		<form id="editForm">
			<table class="table table-bordered animate2 fadeInUp">
				<tr>
					<td>出库仓名称:&nbsp;&nbsp;&nbsp;
						<input id="dname" name="dname" value="${(invSaleInfo.dname)!''}" type="text" style="width:100px;" placeholder="双击选择"/>
						<input id="dc" name="dc" value="${(invSaleInfo.dc)!''}" type="hidden"/>
					</td>
					<td>销售员:
						<div class="input-append">
							<input class="sn not" id="sname" name="sname" type="text" style="width:120px;" readonly />
							<input id="smc" name="smc" type="hidden" />
							<button class="btn btn-xs btn-primary" type="button" pib="1" onclick="javascript:selectUser_invSaleInfo($(this));return false;"><i class="icon-search"></i></button>
						</div>
					</td>
					<td>客户名称:
						<input class="name" id="name" name="name" type="text" style="width:120px;"/>
					</td>
				</tr>
				<tr>
					<td>请输入序列号:&nbsp;<input type="text" class="add-tag-input" style="width:100px;"/></td>
					<td>收银员:
						<div class="input-append">
							<input class="cashier not" id="cashier" name="cashier" type="text" style="width:120px;" readonly />
							<input id="cac" name="cac" type="hidden" />
							<button class="btn btn-xs btn-primary" type="button" pib="2" onclick="javascript:selectUser_invSaleInfo($(this));return false;"><i class="icon-search"></i></button>
						</div>
					</td>
					<td>电话号码:
						<input class="tel" id="tel" name="tel" type="text" style="width:120px;"/>
					</td>
				</tr>
			</table>
			<table class="table table-bordered animate2 fadeInUp">
				<thead>
					<tr height="40">
						<th>商品名称<a href="javascript:;" onclick="javascript:add_invSaleInfo();return false;" style="margin-left: 10px">[添加空白行]</a></th>
						<th>序列号状态</th>
						<th>库存数量</th>
						<th>数量</th>
						<th>单价（元）</th>
						<th style="text-align: center;">备注</th>
						<th style="width:32px;">操作</th>
					</tr>
				</thead>
				<tbody id="ListBody">
				
				</tbody>
				<tr>
					<td colspan="4">应收:<input type="text" id="receivable" value="" name="receivable"/></td>
					<td colspan="4">实收:<input type="text" id="paidin" name="paidin" class="not"/></td>
				</tr>
				<tr>
					<td colspan="8" style="color: red;">
						无需序列号的和同类序列号的请直接输入零售数量，唯一序列号需依次输入序列号。
					</td>
				</tr>
				<tr height="40">
					<td colspan="8" style="text-align: center;">
						<a href="javascript:;" class="btn btn-info" onclick="javascript: save_invSaleInfo(); return false;"><i class="icon-save"></i>&nbsp;保&nbsp;&nbsp;存</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:;" class="btn btn-primary" onclick="javascript: sys_load_handle('invSaleInfo');return false;"><i class="fontello-icon-block"></i>&nbsp;取&nbsp;&nbsp;消</a>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>

<input type="hidden" id="index" value="${i}" />
<table id="tempTable" style="display:none;" i="0">
	<tr class="rep">
		<td>
			<div class="input-append">
				<input class="cname" type="text" style="width:120px;" readonly />
				<input class="cc" type="hidden" />
				<button class="btn btn-xs btn-primary" type="button" style="display:none;"><i class="icon-search"></i></button>
			</div>
		</td>
		<td><input class="snc" style="width:100px;" type="hidden" readonly/><span class="s"></span></td>
		<td><span class="c"></span></td>
		<td><input class="count" type="text" style="width:60px;" onkeyup="javascript:checkNum_invSaleInfo($(this));return false;"/></td>
		<td><input class="price" type="text" style="width:80px;"/></td>
		<td><textarea class="remark"></textarea></td>
		<input class="to" type="hidden"/>
		<td style="text-align:center;"><a class="btn btn-danger" href="javascript:;" onclick="javascript:delete_invSaleInfo($(this));return false;"><i class="icon-remove"></i></a></td>
	</tr>
	<tr j="0">
		<td colspan="7"></td>
	</tr>
</table>
<div id="tempDiv" style="display:none;">
	<div class="my-filter-table rep">
		<input class="serial form-control" type="hidden" style="width:60px;"/>
		<a href="javascript:;" class="show-serial"></a>&nbsp;&nbsp;&nbsp;&nbsp;
		<button type="button" class="del-tag" data-dismiss="alert">&times;</button>
	</div>
</div>

<script type="text/javascript">
<!--

function countTotalPrice() {
	var price,count,total = 0, thiss;
	$('#ListBody tr.rep').each(function() {
		thiss = $(this);
		count = thiss.find('input.count').val();
		price = thiss.find('input.price').val();
		total = total + count*price;
	});
	$('#receivable').val(total);
}
//-->
</script>
